package com.peanut.bosskg.service.other.separate;

import com.alibaba.fastjson.JSON;
import com.peanut.bosskg.entity.ResponseMessageVO;
import com.peanut.bosskg.entity.separate.RechargeResultVO;
import com.peanut.bosskg.enums.FunCodeEnum;
import com.peanut.bosskg.service.BaseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * @param
 * @author LMH
 * @return
 * @description
 * @createby 2022-06-13 14:16
 */
@Service
@Slf4j
public class RechargeResultQueryService extends BaseService {
    /**
     * @param funCodeEnum
     * @param orderNo 订单流水号
     * @param enpterpriseOrderNo 商户订单流水
     * @return
     * @throws Exception
     */
    public RechargeResultVO doBusiness(FunCodeEnum funCodeEnum, String orderNo, String enpterpriseOrderNo) throws Exception {
        log.info("用户充值结果查询接口开始:{}，orderNo={}，enpterpriseOrderNo={}", funCodeEnum, orderNo, enpterpriseOrderNo);
        Map<String, String> queryMap = new HashMap<>();
        queryMap.put("enterpriseOrderNo", enpterpriseOrderNo);
        queryMap.put("orderNo", orderNo);
        ResponseMessageVO responseMessage = applyYouFuByHttpPost(funCodeEnum, queryMap);
        RechargeResultVO resultVO = JSON.parseObject(responseMessage.getResData(), RechargeResultVO.class);
        log.info("用户充值结果查询接口结束:{}", resultVO);
        return resultVO;
    }
}
